<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="box">构造函数继承</div>
</body>
<script>
   function Father(name,age){
    console.log(name);
    console.log(age);
     this.name = '张三'
     this.age = 18
     this.sex = '男'
     this.play = function(){
        console.log('打游戏');
     }
   }
   Father.prototype.fn = function(){
    console.log('父类原型上的方法');
   }
//    let fa = new Father()
//    console.log(fa);

   function Son(name,age){
    //   构造函数继承的过程 ：使用call 或者apply方法 将父类的构造函数绑定在子类的对象上
      Father.apply(this,[name,age])
    //   console.log(this);

   }
  let son =  new Son('刘德华',18)
  console.log(son);

//   缺点：  子类没有办法继承父类原型上的方法
</script>
</html>